﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using HZ.MBSM.DBUtility;
using HZ.MBSM.Model;
public partial class Bidder_SuitTestimonyReply : System.Web.UI.Page
{
      string id = "";
    protected void Page_Load(object sender, EventArgs e)
    {
        System.Collections.Generic.List<HZ.MBSM.DAL.AccountType> _AccountType = new System.Collections.Generic.List<HZ.MBSM.DAL.AccountType>();
      _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAdmin);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumAttorney);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumBidGoods);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumCheckCompany);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumCheckGoods);
        _AccountType.Add(HZ.MBSM.DAL.AccountType.enumCheckProjectComp);
        if (HZ.MBSM.BLL.Login.CheckAssert(_AccountType))
        {
            id = SysFun.IsSQL(Request.QueryString["id"]);
            if (!IsPostBack)
            {
                InitPage();
            }
        }
    }
    private void InitPage()
    {
        string strSql = "select * from SuitTestimony  where id=" + id + "";
        Db db = new Db();
        System.Data.IDataReader dr;
        dr = db.DataReader(strSql);
        if (dr.Read())
        {
            txtAccountName.Text = SysFun.ToTrim(dr["TWname"]);
            txtContent.Text = SysFun.ToTrim(dr["Content"]);
            txtExplain.Text = SysFun.ToTrim(dr["Explain"]);
            txtTitle.Text = SysFun.ToTrim(dr["Title"]);
        }
        dr.Close();
        dr.Dispose();
        db.Close();
    }
    protected void  sub_Click(object sender, EventArgs e)
    {
        string  AnswerId,strSql;
        HZ.MBSM.Model.Account _Account = (HZ.MBSM.Model.Account)Session["Account"];
        if (_Account != null)
        {
            AnswerId = SysFun.ToTrim (_Account.AccountId);
            strSql = "update SuitTestimony set AnswerId='" + AnswerId + "',Explain='" + SysFun.ToTrim(txtExplain.Text) + "',AnswerDate='" + SysFun.ToTrim(DateTime.Now) + "' where id =" + id + "";
            Db db = new Db();
            db.Command(strSql);
            db.Close();
            HZ.MBSM.BLL.LogManage.RecordLoginDetail(_Account.AccountName, Request.UserHostAddress, "修改", "SuitTestimony", strSql, "../Bidder/SuitTestimonyReply.aspx");

            Response.Write("<script language=JavaScript>alert('回复成功！！！');</script>");
            Response.Write("<script>window.opener.location.reload();window.close();</script>");

        }
        else
        {
            Response.Write("<script language=JavaScript>alert('您还未登录，暂时无法回复！！！');</script>");
        }
        
    }


}
